package com.hebeiboruan.common.uitl;

import cn.hutool.core.util.IdUtil;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class FileUtil {
    public static String upload(MultipartFile multipartFile,String path) throws IOException {
        String id = IdUtil.randomUUID();
        String contentType = multipartFile.getOriginalFilename().split("\\.")[1];
        multipartFile.transferTo( new File(path+id+"."+contentType));
        return "http://192.168.2.49:8080/"+id+"."+contentType;
    }
}
